package ru.home.documentmanager.service.impl;

import java.util.List;

import javax.annotation.Resource;
import javax.transaction.Transactional;

import org.springframework.stereotype.Service;

import ru.home.documentmanager.dao.FileDocDAO;
import ru.home.documentmanager.model.FileDoc;
import ru.home.documentmanager.model.User;
import ru.home.documentmanager.service.FileDocService;

@Service("fileDocService")
public class FileDocServiceImpl implements FileDocService {

    @Resource
    private FileDocDAO fileDocDAO;

    @Override
    @Transactional
    public void save(FileDoc object) {
        fileDocDAO.save(object);
    }

    @Override
    @Transactional
    public void update(FileDoc object) {
        fileDocDAO.update(object);
    }

    @Override
    @Transactional
    public void saveOrUpdate(FileDoc object) {
        fileDocDAO.saveOrUpdate(object);
    }

    @Override
    @Transactional
    public void delete(FileDoc object) {
        fileDocDAO.delete(object);
    }

    @Override
    @Transactional
    public List<FileDoc> find() {
        return fileDocDAO.find();
    }

    @Override
    @Transactional
    public FileDoc find(long id) {
        return fileDocDAO.find(id);
    }

    @Override
    @Transactional
    public FileDoc find(String name, User user) {
        return fileDocDAO.find(name, user);
    }

    @Override
    @Transactional
    public void delete(long id) {
        fileDocDAO.delete(id);
    }

}
